package net.lzzy;

import net.lzzy.Circle;
import net.lzzy.GeometricObject;
import net.lzzy.Rectangle;
import net.lzzy.Elliptic;

public class BoundedTypeDemo {
    public static void main(String[] args) {
        Rectangle rectangle = new Rectangle(2,2);
        Circle circle = new Circle(2);
        Elliptic el = new Elliptic(1,2);
        System.out.println("Same area? " + equalArea(rectangle,circle));
        System.out.println("Same perimeter? " + equalPerimeter(rectangle,circle));

        System.out.println("Same area? " + equalArea(el,circle));
        System.out.println("Same perimeter? " + equalPerimeter(el,circle));
    }

    private static <E extends GeometricObject> boolean equalArea(E object1, E object2) {
        return object1.getArea() == object2.getArea();
    }
    private static <E extends GeometricObject> boolean equalPerimeter(E object1, E object2) {
        return object1.getPerimeter() == object2.getPerimeter();
    }

}
